﻿#ifndef RENDER_H
#define RENDER_H

#include <QWidget>
#include <QMenu>
#include <QImage>
#include <QPainter>
#include <QResizeEvent>
#include "Common/ImageScaler.h"

class Render:public QWidget
{
    Q_OBJECT
public:
    Render(RENDER_TYPE type,int width,int height,QWidget *parent = nullptr);
    //渲染图片
    virtual int Draw(Frame *Frame){return 0;}

    void DeInit();
    int  GetWidth();
    int  GetHeight();
    void StartPlay();
    void StopPlay();
    virtual ~Render();

protected:
    RENDER_TYPE m_RenderType;                  //渲染器类型
    int x;                                     //起始位置x
    int y;                                     //起始位置y
    int m_WinWidth;                            //窗口宽
    int m_WinHeight;                           //窗口高
    int m_VideoWidth;                          //视频宽
    int m_VideoHeight;                         //视频高
    int m_ImgWidth;                            //img宽
    int m_ImgHeight;                           //img高
    ImageScaler *img_scaler;                   //图片缩放
    bool req_resize;                           //是否更改大小
    VideoFrame dst_video_frame;                //目标视频帧
    QImage Img;                                //图片
    int play_state;                            // 0 初始化状态; 1 播放状态; 2 停止状态
};

#endif // RENDER_H
